package demo2;

import java.util.ArrayList;
import java.util.Collections;

public class Test {

    public static void main(String[] args) {
//        MyArrayList myArrayList = new MyArrayList();
//        myArrayList.add(0,1);
//        myArrayList.add(1,2);
//        myArrayList.add(2,3);
//        myArrayList.add(3,4);
//        myArrayList.add(4,5);
//        myArrayList.display();
//        System.out.println("===========");
//        myArrayList.set(0,99);
//        myArrayList.display();
//        myArrayList.set(4,99);
//        myArrayList.display();
//        System.out.println("===========");
//        myArrayList.clear();
//        myArrayList.display();

        ArrayList<Integer> list = new ArrayList<>();
        list.add(1);
        list.add(4);
        list.add(2);
        list.add(7);
        list.add(3);
        Collections.sort(list);
        System.out.println(list);

    }

    public static void main1(String[] args) {
        MyArrayList myArrayList = new MyArrayList();
        myArrayList.add(0,1);
        myArrayList.add(1,2);
        myArrayList.add(2,3);
        myArrayList.add(3,4);
        myArrayList.add(4,5);
        myArrayList.add(5,99);
        myArrayList.display();
        System.out.println("===========");
        System.out.println(myArrayList.get(0));
        System.out.println(myArrayList.get(2));
        System.out.println(myArrayList.get(5));
        System.out.println(myArrayList.get(-1));

    }
}
